In an optical input device (image input apparatus) such as a scanner and a digital camera, light collected through a lens is photoelectrically converted into an electric signal by an image sensing element, a capture image is A/D (Analog/Digital) converted into digital data, and then an image corresponding to the digital data is outputted to an output device (image output apparatus) such as a display and a printer. During the processes before the image output, some imaging processings, such as converting an image processing mode according to the output device, are carried out in combination. The image sensing element can be a CCD (Charge Coupled Apparatus) image sensor, a CMOS (Complementary Metal Oxide Semiconductor) image sensor, a CIS (Contact Image Sensor), or the like, for example.
For example, Patent Literature 1 (Japanese Patent No. 3472479, publication date: Dec. 10, 1999) discloses a device called multifunction printer or digital copying machine, including an inkjet or laser printer (image output apparatus) and a scanner (image input apparatus) that uses a one-dimensional line CCD sensor as an image sensing element. In this device, multi-valued image data having been subjected to various image processings is subjected to a halftone output processing for quasi-tone reproduction in such a grey level that is reproducible in the image output apparatus. Thereafter, the data thus processed is outputted to the image output apparatus.
In general, the halftone output processing is carried out by using a dither method or an error diffusion method. The error diffusion method is one of random dither methods and is for binarizing a quantization-target pixel with a certain threshold value by adding, to the quantization-target pixel, a difference between a binarized image and its original image at a binarized pixel that is located in the vicinity of the quantization-target pixel and has been already binarized, which difference is weighted according to a distance between the quantization-target pixel and the binarized pixel. With the error diffusion method, a local average error in the binarized image is reduced as small as possible.
FIG. 12 is a view illustrating an error diffusion method used in a conventional image processing apparatus. FIG. 12 exemplifies a case where an input image is a single plane image expressed in 8 bits. FIG. 13 is a flow diagram illustrating processes of an error diffusion method carried out in a conventional image processing apparatus.
As shown in FIG. 13, in a conventional error diffusion method, a quantization-target pixel (x, y) is quantized at first (S10).
In a case of binary quatization, for example, a pixel value P(x, y) of the quantization-target pixel (x, y) is compared to a threshold value V. A quantization value O(x, y) is represented by OU when the pixel value P(x, y) is equal to or more than the threshold value V, and is represented by OD when the pixel value P is less than the threshold value V. For example, the threshold value V can be 128, the quantization value OD can be 0, and the quantization value OU can be 255.
In a case of four-valued quantization, the pixel value P(x, y) of the quantization-target pixel (x, y) is compared to threshold values T0, T1, and T2, respectively, so that the quantization value O(x, y) is represented by either O0, O1, O2, or O3 in accordance with conditions determined in advance as shown in Table 1. For example, the threshold values T0, T1, and T2 can be 43, 128, and 213, respectively, and the quantization values O0, O1, O2, and O3 can be 0, 85, 170, and 255, respectively.
TABLE 1Selection condition ofQuantizationquantization valuevalue QP (x, y) < T0Q0T0 ≦ P (x, y) < T1Q1T1 ≦ P (x, y) < T2Q2T2 ≦ P (x, y)Q3
Next, a quantization error is calculated (S11). A quantization error Qerr is calculated with Equation (1):Qerr(x,y)=P(x,y)−O(x,y)  Equation (1).
Then, diffusion errors are calculated (S12). For example, diffusion errors DEa(x, y), DEb(x, y), DEc(x, y), and DEd(x, y) to be applied to respective neighboring pixels (x+1, y), (x−1, y+1), (x, y+1), and (x+1, y+1) shown in FIG. 12 are calculated with Equations (2) through (5), respectively, by using diffusion coefficients shown in FIG. 12:DEa(x,y)=Qerr(x,y)×½  Equation (2),DEb(x,y)=Qerr(x,y)×⅛  Equation (3),DEc(x,y)=Qerr(x,y)×¼  Equation (4),DEd(x,y)=Qerr(x,y)×⅛  Equation (5).
Then, error addition is carried out (S13). In the error addition, as shown in Equations (6) through (9), the diffusion errors calculated in the step S12 are spread (added) to each of the neighboring pixels that have not been quantized:P(x+1,y)=P(x+1,y)+DEa(x,y)  Equation (6),P(x−1,y+1)=P(x−1,y+1)+DEb(x,y)  Equation (7),P(x,y+1)=P(x,y+1)+DEc(x,y)  Equation (8),P(x+1,y+1)=P(x+1,y+1)+DEd(x,y)  Equation (9).
By repeating the steps S10 through S13 in each pixel in a raster order from upper left pixels to lower right pixels, it is possible to output an image reproduced in a certain quantization tone (in this case, 2 tones and 4 tones, for example) from 8 bit input tone. When an input image includes a plurality of color planes (color components), the above-mentioned processes are carried out with respect to each of the color planes, so that it becomes possible to output an image reproduced in a certain quantization tone from the input image expressed in each tone of the color planes.
In general, the tone reproduction using the error diffusion method has the following problems: (1) rising of an output dot is more likely to delay in a high-brightness region (low-density region); and (2) a pattern (texture) unique to the error diffusion is easy to see particularly in a region of high brightness and few tone changes.
For the purpose of solving the problems above, such a method is widely used that a random noise or high-frequency noise (blue noise) is added to input data or a threshold value used in quantization. For example, Non Patent Literature 1 (“Threshold control technique for error diffusion method” Toshiaki KAKUTANI, DENSHI SHASHIN GAKKAISHI (Electrophotography), Vol. 37 (1998) No. 2, pp. 186-192) describes (i) noise application to a threshold value and (ii) an error diffusion method based on threshold optimization.
With the method of Non Patent Literature 1, it is possible to reduce the problems (1) and (2) above. However, there arises the other problem (3) that noise addition to a large region of few tone changes causes a reduction in uniformity depending on a dynamic range of the noise to be added. That is to say, a technique for adding noise to a threshold value cannot solve both of the problems (2) and (3), which trade off with each other in regard to image quality.
In order to solve the problems (2) and (3), Patent Literature 2 (Japanese Unexamined Patent Publication, Tokukai No. 2003-23540, publication date: Jan. 24, 2003) discloses a technique for spatially equalizing a dot occurrence ratio by (i) detecting a neighboring pixel that has been quantized and forms a dot within a predetermined range from a quantization-target pixel of an input image signal to be quantized, and then by (ii) suppressing a dot formation at a position of the quantization-target pixel based on a density of the neighboring pixel before quantization, a density of the quantization-target pixel, and a distance between the quantization-target pixel and the neighboring pixel.
However, with the technique of Patent Literature 2, it is necessary to carry out, in each quantization of pixels, (i) detecting the neighboring pixel that forms a dot, by sequentially scanning quantized neighboring pixels within the predetermined range of distance from the quantization-target pixel to be quantized, (ii) finding pre-quantization densities of all of the detected neighboring pixels, (iii) calculating a distance between the quantization-target pixel and each of the detected neighboring pixels, (iv) detecting a density of the quantization-target pixel, and (v) determining whether to suppress a dot formation at the position of the quantization-target pixel based on the pre-quantization densities of all of the detected neighboring pixels, the density of the quantization-target pixel, and the distance between the quantization-target pixel and each of the detected neighboring pixels.
Therefore, the technique of Patent Literature 2 requires a larger number of processing steps and a larger amount of processing than a normal error diffusion method, thereby causing a problem of large processing load. Further, determining whether to suppress the dot formation uses the pre-quantization densities of all of the detected neighboring pixels. Therefore, it is necessary to provide storage means for storing pre-quantization image data.